import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/Login'
import Register from '@/views/Register'
import Detail from '@/views/Detail'
import Layout from '@/views/Layout'

import Like from '@/views/second/Like'
import Article from '@/views/second/Article'
import Collect from '@/views/second/Collect'
import User from '@/views/second/User'

Vue.use(VueRouter)

const routes = [
  // 一级路由
  //  path: 路径 , component: 组件名
  { path: '/login', component: Login },
  { path: '/register', component: Register },
  { path: '/detail', component: Detail },
  {
    // 路径为 '/' 表示 默认地址
    path: '/',
    component: Layout,
    // 二级路由
    children: [
      { path: '/article', component: Article },
      { path: '/like', component: Like },
      { path: '/collect', component: Collect },
      { path: '/user', component: User }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
